﻿using System;
using System.Linq;
using System.Windows.Forms;
using Sumen.Business;
using DevExpress.XtraSplashScreen;
using Sumen.Library.Enum;

using Sumen.Business.Permission;
using Sumen.Business.Presenter.Sys;
using Sumen.Library.Froms;


namespace Sumen.GUI.Sumen_System
{
    public partial class Frm_History_System : XtraUserControlKira
    {
        private SysLogPresenter _logPresenter;

        public Frm_History_System()
        {
            InitializeComponent();
            FormCode = EnumFormCode.FrmHistorySystem;
            buttonsArray1.capQuyen(new Permission(FormCode.ToString(), ClsPublic.User.User_Username));
            dateBegin.DateTime = DateTime.Today;
            dateEnd.DateTime = dateBegin.DateTime.AddDays(1).AddMinutes(-1);
            _logPresenter = new SysLogPresenter();
        }



        public override void LoadForm()
        {
            gridControl1.DataSource = _logPresenter.GetLog(dateBegin.DateTime, dateEnd.DateTime).First();
        }

        private void buttonsArray1_btnEventClose_click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void buttonsArray1_btnEventView_click(object sender, EventArgs e)
        {
            LoadForm();
        }


    }
}